<?php

/**
 * Clan filter form base class.
 *
 * @package    rpgcom
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseClanFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'description'  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'idSupplement' => new sfWidgetFormPropelChoice(array('model' => 'Supplement', 'add_empty' => true)),
      'Atb1'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'Atb2'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'name'         => new sfValidatorPass(array('required' => false)),
      'description'  => new sfValidatorPass(array('required' => false)),
      'idSupplement' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Supplement', 'column' => 'idSupplement')),
      'Atb1'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'Atb2'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('clan_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Clan';
  }

  public function getFields()
  {
    return array(
      'idClan'       => 'Number',
      'name'         => 'Text',
      'description'  => 'Text',
      'idSupplement' => 'ForeignKey',
      'Atb1'         => 'Number',
      'Atb2'         => 'Number',
    );
  }
}
